package main

import (
	"encoding/base64"
	"fmt"
	"io"
	"log"
	"strings"
)

func main() {

	decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader("Zm9vAGJhcg=="))

	var buf = make([]byte, 50)

	_, err := decoder.Read(buf)
	if err != nil && err != io.EOF {
		log.Fatal(err)
	}

	//decoded result foobar
	fmt.Printf("decoded result %s", string(buf))
}
